package com.base_data_handler.utils;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class DBUtil {
	
	static {
		try {
			Class.forName(PropertiesUtil.JDBC_DRIVER.trim());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public  Connection getConnection() throws SQLException {
		
		return DriverManager.getConnection(PropertiesUtil.JDBC_URL.trim(), PropertiesUtil.JDBC_USER.trim(), PropertiesUtil.JDBC_PASS.trim());
	}

	public  void close(ResultSet rs, Statement stmt, Connection conn) throws SQLException{
		if (rs != null)
		{
			rs.close();
		} 
		if (stmt != null)
		{
			stmt.close();
		} 
	    if (conn != null)
	    {
			conn.close();
		}
	}
	
}
